package com.gewu.bluetoothflow.view;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Spinner;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.gewu.bluetoothflow.R;

import java.util.ArrayList;


public class TipDialog extends Dialog {
    private String TAG = TipDialog.class.getName();


    ArrayList<String> roomName = new ArrayList<String>();
    TextView tipName = null;
    TextView tipContent = null;
    TextView devNick = null;
    Spinner raddr = null;


    String mtitle = "";
    String mContent = "";
    Context mcontext = null;

    public TipDialog(@NonNull Context context, int themeResId, String title, String content) { // roomList:MutableList<RoomInfo>
        super(context, themeResId);
        mcontext = context;
        this.mtitle = title;
        mContent = content;
    }
   public interface EditDevClickListener{
        public void onclickSave();
    }

    public EditDevClickListener listener;

    public void setSaveListener(EditDevClickListener listener){
          this.listener = listener;
    }

    public TipDialog(@NonNull Context context, int themeResId) {
        super(context, themeResId);
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_tip);
        tipName = findViewById(R.id.tipName);
        tipContent = findViewById(R.id.tipContent);
        tipName.setText(mtitle);
        tipContent.setText(mContent);

        findViewById(R.id.add_cancel).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              dismiss();
            }
        });
        findViewById(R.id.add_save).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                listener.onclickSave();
            }
        });

    }
}
